package com.sourcestream.whileaway;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.telephony.TelephonyManager;
import android.widget.Toast;

import java.util.Date;

public class SmsReceiver extends BroadcastReceiver
{
    public void onReceive(Context context, Intent intent)
    {
        SharedPreferences sp = context.getSharedPreferences("PhoneState", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sp.edit();

        int missedTexts = sp.getInt("MissedTexts", 0) + 1;
        editor.putInt("MissedTexts", missedTexts);
        editor.putLong("LastMissedText", new Date().getTime());
        editor.commit();
    }
}
